import socket as so
import threading as td
import time as t

# 建立连接
so = so.socket()
so.connect(("192.168.223.6",7999))

# 发送招呼包
so.send("".encode())

def send_usr_text():
    while True:
        t.sleep(0.5)
        so.send(input("请输入聊天内容：").encode())

ui = td.Thread(target=send_usr_text)
ui.start()

while True:
    recv_text =so.recv(1024).decode("utf-8")
    print(recv_text)
